# -*- coding: utf-8 -*-

"""
DateTime   : 2020/12/20 19:49
Author     : ZhangYafei
Description: 
"""
class Shape:
    def what_am_i(self):
        print('I am a shape')

class Recrangle(Shape):
    def __init__(self, width, height):
        self.width = width
        self.height = height

    def calculate_perimeter(self):
        return 2 * (self.width + self.height)


class Square(Shape):
    def __init__(self, width):
        self.width = width

    def calculate_perimeter(self):
        return self.width ** 2

    def change_size(self, length):
        self.width += length


class Horse:
    def __init__(self, name, owner):
        self.name = name
        self.owner = owner

class Rider:
    def __init__(self, name, age):
        self.name = name
        self.age = age


if __name__ == '__main__':
    square = Square(width=10)
    rect = Recrangle(width=4, height=5)
    square.what_am_i()
    tom = Rider(name='Tom', age=18)
    horse = Horse(name='汗血宝马', owner=tom)
    print(horse.owner.name)
